Skip to content

Retry quay.io request on 520 responses - #5

Merged
stefan-as merged 1 commit into
masterfrom
feature/retry_on_520
Jan 31, 2020
Merged

Retry quay.io request on 520 responses#5
stefan-as merged 1 commit into
masterfrom
feature/retry_on_520

Conversation

@stefan-as

Copy link
Copy Markdown
Contributor

No description provided.

@stefan-as
stefan-as requested a review from bennibu January 27, 2020 14:25

@bennibu bennibu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Mit ein paar Kommentaren zurück. Sonst sieht das aber gut aus finde ich.

accept: :json)
rescue RestClient::ExceptionWithResponse => err
return nil if err.http_code == 404 # ignore unknown repos
if err.http_code == 520 and attempt < MAX_ATTEMPTS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warum versucht ihr es nur bei 520? Das ist ja sogar ein Spezialfall von Cloudflare. Warum nehmt ihr nicht einfach alle 500?

Suggested change
if err.http_code == 520 and attempt < MAX_ATTEMPTS
if err.http_code >= 500 and attempt < MAX_ATTEMPTS

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, gute Frage, ich bin unentschlossen. Uns nervt gerade der 520, weil wir wissen, dass das ein temporäres Problem ist und das weggeht, wenn zu einem späteren Zeitpunkt ein erneuter Request kommt. Andere 500 haben wir nicht gesehen und wir wissen auch nicht, wie dann die Situation aussieht. Daher würde ich für den Moment abwarten, bis wir in eine solche Situation kommen und dann bewerten, ob wir alle 500 abfangen.

rescue RestClient::ExceptionWithResponse => err
return nil if err.http_code == 404 # ignore unknown repos
if err.http_code == 520 and attempt < MAX_ATTEMPTS
sleep(rand(10))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warum hier ein Zufall beim warten auf den nächsten Versuch? Ich kenne sonst das Pattern, dass mit jedem weiteren Versuch länger gewartet wird (als Optimierung der Gesamtwartezeit). Ich würde daher schreiben

Suggested change
sleep(rand(10))
sleep(attempt ** 2)

Das ** steht für Potenz.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das Problem scheint daher zu kommen, dass bei einem Check-Request alle Docker-Nodes gleichzeitig zu quay.io rennen. Das würde sich nicht ändern, wenn alle Nodes deterministisch warten, um dann erneut gleichzeitig bei quay.io anzufragen. Ich will hier bewusst für eine zufällige zeitliche Streuung der Requests über die einzelnen Nodes sorgen.

@stefan-as
stefan-as merged commit dbc25ce into master Jan 31, 2020
@jonathanschlue-as
jonathanschlue-as deleted the feature/retry_on_520 branch May 23, 2022 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants